#define D(x) {x=p[e++]-48;if(p[e]!=32&&p[e])x+=9*x+p[e]-48,e++;e++;}
int c,n,e,b;char t[20];
void main(int y,char**a){char*p=*a;gets(p);D(y);while(y--){gets(p);e=0;D(c)t[n]-=c-1;while(c--){D(b)t[n]+=b;}n++;}y=0;while(y<n-1)printf("%d\n",t[y++]);printf("%d",t[y]);}